{extend name="app/shop/view/base.html"/}
{block name="resources"}
<link rel="stylesheet" href="SHOP_CSS/goods_lists.css">
<style>
    .layui-layer-page .layui-layer-content {
        padding: 20px 30px;
    }
</style>
{/block}
{block name="main"}

<div class="layui-tab table-tab" lay-filter="group_member_tab">
    <div class="layui-tab-content">
        <!-- 列表 -->
        <table id="group_member_list" lay-filter="group_member_list"></table>
    </div>
</div>

<!-- 会员 -->
<script type="text/html" id="member_info">
    <div class="table-title">
        <div class="title-pic">
            <img layer-src src="{{ns.img(d.headimg) || '{:img('public/static/img/default_img/head.png')}'}}" onerror="this.src = '{:img('public/static/img/default_img/head.png')}' ">
        </div>
        <div class="title-content">
            <a href="javascript:;" class="multi-line-hiding text-color-sub"
               title="{{d.nickname}}">{{d.nickname}}</a>
        </div>
    </div>
</script>
{/block}
{block name="script"}
<script>
    layui.use(['form', 'element'], function () {
        var table, form = layui.form, element = layui.element;
            form.render();

        //监听Tab切换，以改变地址hash值
        element.on('tab(group_member_tab)', function () {
            table.reload({
                page: {curr: 1},
                where: {'status': this.getAttribute('lay-id')},
            })
        });
        var group_id = {$group_id};
        // 券名称、发起时间、已参与人数/需成团人数、成团截止时间、操作（参与人列表）
        table = new Table({
            elem: '#group_member_list',
            page: false,
            url: ns.url("hongbao://shop/hongbao/groupMember", {'group_id': group_id}),
            cols: [
                [{
                    title: '会员信息',
                    unresize: 'false',
                    width: '17%',
                    templet: '#member_info'
                },{
                    title: '活动内容',
                    field: 'name',
                    unresize: 'false',
                    width: '12%',
                    templet: function (data) {
                        return data.divide_num + '人瓜分'+ data.money + '元';
                    }
                },{
                    title: '瓜分金额',
                    unresize: 'false',
                    width: '12%',
                    templet: function (data) {
                        var content = '';
                        if(data.balance_money == undefined || data.balance_money == ''){
                            content = '';
                        }else{
                            content = data.balance_money + '元';
                        }
                        return content;
                    }
                }]
            ],
        });

    });

</script>
{/block}